<template>
  <div>
    <!-- 面包屑 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 列表 -->

    <!-- 用户列表 -->
    <el-table :data="rightList" border stripe>
      <el-table-column type="index"></el-table-column>
      <el-table-column prop="authName" label="权限名称"></el-table-column>
      <el-table-column prop="path" label="路径"></el-table-column>

      <!-- 权限 -->
      <el-table-column prop="level" label="权限等级">
        <template slot-scope="scope">
          <!-- {{scope.row}} slot-scope="scope"-->
          <el-tag type="success" v-if="scope.row.level=='0'">等级1</el-tag>
          <el-tag type="waring" v-else-if="scope.row.level=='1'">等级2</el-tag>
          <el-tag type="info" v-else>等级3</el-tag>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      rightList: []
    }
  },
  methods: {
    async getList() {
      const { data: res } = await this.$http.get('rights/list')
      console.log(res)
      this.rightList = res.data
      if (res.meta.status !== 200) {
        data.mg_state != data.mg_state
        this.$message.error('获取数据失败')
        return
      }
    }
  },
  created() {
    this.getList()
  }
}
</script>
<style lang="less" scoped>
</style>